package com.dosen.api.thought.core.provider.aop;

import com.dosen.api.servlet.common.util.AspectDoAround;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Slf4j
@Aspect
@Component
public class WebLogAspect {



    @Pointcut("execution(public * com.dosen.api.thought.core.provider.controller..*.*(..))")
    public void webLog1() {
    }

    @Around("webLog1()")
    public Object controllerAround(ProceedingJoinPoint joinPoint) throws Throwable {
        return doAround(joinPoint);
    }


    @Pointcut("execution(public * com.dosen.api.thought.core.provider.web..*.*(..))")
    public void webLog2() {
    }

    @Around("webLog2()")
    public Object webAround(ProceedingJoinPoint joinPoint) throws Throwable {
        return doAround(joinPoint);
    }


    /**
     *
     * @param joinPoint
     * @return
     * @throws Throwable
     */
    private Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
        return AspectDoAround.doAround(joinPoint);
    }

}
